<!--移动端版本兼容 -->
if(/Android (\d+\.\d+)/.test(navigator.userAgent)){
	var version = parseFloat(RegExp.$1);
	if(version>2.3){
		var phoneScale = parseInt(window.screen.width)/640;
		document.write('<meta name="viewport" content="width=640, minimum-scale = '+ phoneScale +', maximum-scale = '+ phoneScale +', target-densitydpi=device-dpi">');
	}else{
		document.write('<meta name="viewport" content="width=640, target-densitydpi=device-dpi">');
	}
}else{
	document.write('<meta name="viewport" content="width=640, user-scalable=no, target-densitydpi=device-dpi">');
}
<!--移动端版本兼容 end -->


<!----------------------------------------------判断横竖屏,isH为true时为横屏时提示(默认)，为false时为竖屏时提示------------------------->
setVH(true);
var isH;
function setVH(__isH){
	if(__isH==null){
		isH=true;
	}else{
		isH=__isH;
	}
	
	var hDiv;
	
	if(isH==true){//横屏时提示把屏竖过来
		hDiv = document.createElement('div');
		hDiv.id='landscape';
		hDiv.className='horizontal';
		document.body.appendChild(hDiv);
	}else{
		hDiv = document.createElement('div');
		hDiv.id='landscape';
		hDiv.className='vertical';
		document.body.appendChild(hDiv);
	}
}

//判断横屏
var initFlag = true;
var landscape = false;
function orien() {
	//alert(window.orientation);
	if (window.orientation == 90 || window.orientation == -90) {
		//alert("这是横屏");
		if(isH==true){
			if(initFlag) {
				initFlag = false;
				landscape = true;
			}
			$("#landscape").show();
		}else{
			if(initFlag) {
				initFlag = false;
			}
			if(landscape) {
				window.location.reload(true);
			} else {
				$("#landscape").hide();
			}
		}
	} else {
		if(isH==true){
			if(initFlag) {
				initFlag = false;
			}
			if(landscape) {
				window.location.reload(true);
			} else {
				$("#landscape").hide();
			}
		}else{
			if(initFlag) {
				initFlag = false;
				landscape = true;
			}
			$("#landscape").show();
			alert(isH);
		}
		//alert("这是竖屏");
	}
};

orien();
$(window).on("orientationchange", orien);
<!---------------------------------------------------------------------判断横竖屏 end----------------------------------------------->





<!---------------------------------------------音频---------------------------------------------------->
//musicWX是判断是否是用微信打开的
var ua = navigator.userAgent, musicWX = /MicroMessenger/i.test(ua), ios = /ip(?=od|ad|hone)/i.test(ua);
var global_click = false;

var musicNum=0;
function Mobj(){
	this.obj;
}

Mobj.prototype.obj={
		myid:'',//此音频的id
		src:null,//音频路径
		autoplay:false,//是否自动播放
		loop:false,//是否循环
		preload:false,//是否预加载
		isCreat:false,//是否已经创建完了一个音频对象
		myMusic:null
	};

Mobj.prototype={
	init:function(obj){
		this.obj=obj;
		if(this.obj.myid==null){
			this.obj.myid='music'+musicNum;
			musicNum++;
		}
		if(this.obj.isCreat==true)return;
		this.obj.isCreat=true;
		var str='<audio id='+this.obj.myid+' class="none" src='+this.obj.src+'></audio>';
		$('body').append(str);
		if(this.obj.autoplay==true){
			$('#'+this.obj.myid).attr('autoplay','autoplay');
		}
		if(this.obj.loop==true){
			$('#'+this.obj.myid).attr('loop','loop');
		}
		if(this.obj.preload==true){
			$('#'+this.obj.myid).attr('preload','auto');
		}
		this.obj.myMusic=document.getElementById(this.obj.myid);
	},
	play:function(){
		this.obj.myMusic.play();
	},
	pause:function(){
		this.obj.myMusic.pause();
	}
}
<!---------------------------------------------音频  end---------------------------------------------------->



